//
//  YXSalesVolumeView.m
//  跑跑快销
//
//  Created by 杨潇 on 14-5-5.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#import "YXSalesVolumeView.h"

@implementation YXSalesVolumeView
@synthesize calendarBtn,shopBtn,kindBtn,numberMoneryLab;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat:@"yyyy-MM-dd"];
        NSString * dateStr = [formatter stringFromDate:[NSDate date]];
        calendarBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        calendarBtn.backgroundColor = [UIColor whiteColor];
        calendarBtn.frame = CGRectMake(0, 0, 320, 40);
        [calendarBtn setTitle:dateStr forState:UIControlStateNormal];
        [self addSubview:calendarBtn];
        
        shopBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        [shopBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        shopBtn.backgroundColor = [UIColor whiteColor];
        [shopBtn setTitle:@"店铺" forState:UIControlStateNormal];
        shopBtn.frame = CGRectMake(0, calendarBtn.frame.origin.y + calendarBtn.frame.size.height, 160, 40);
        shopBtn.layer.borderColor = [UIColor blackColor].CGColor;
        shopBtn.layer.borderWidth = .25;
        [self addSubview:shopBtn];
        
        kindBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        [kindBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        kindBtn.backgroundColor = [UIColor whiteColor];
        [kindBtn setTitle:@"货品" forState:UIControlStateNormal];
        kindBtn.frame = CGRectMake(shopBtn.frame.size.width + 1, shopBtn.frame.origin.y, 159, 40);
        kindBtn.layer.borderColor = [UIColor blackColor].CGColor;
        kindBtn.layer.borderWidth = .25;
        [self addSubview:kindBtn];

        NSArray * typeArr = [NSArray arrayWithObjects:@"货品名",@"数量",@"销量(元)",nil];
        int typeW = 320/3;
        for (int i = 0; i < 3; i ++) {
            UILabel * typeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 + typeW*i, kindBtn.frame.origin.y + kindBtn.frame.size.height, typeW, 30)];
            typeLabel.text = [typeArr objectAtIndex:i];
            typeLabel.backgroundColor = [UIColor whiteColor];
            typeLabel.layer.borderColor = [UIColor brownColor].CGColor;
            typeLabel.layer.borderWidth = .5;
            typeLabel.textAlignment = NSTextAlignmentCenter;
            typeLabel.font = [UIFont systemFontOfSize:15];
            [self addSubview:typeLabel];
        }
        
        UILabel * moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 30 - STARTY, 160, 30)];
        moneyLabel.text = @"现金(元)";
        moneyLabel.font = [UIFont systemFontOfSize:15];
        moneyLabel.layer.borderColor = [UIColor brownColor].CGColor;
        moneyLabel.layer.borderWidth = .5;
        moneyLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:moneyLabel];
        
        numberMoneryLab = [[UILabel alloc] initWithFrame:CGRectMake(160, moneyLabel.frame.origin.y, 160, 30)];
        numberMoneryLab.text = @"0";
        numberMoneryLab.font = [UIFont systemFontOfSize:15];
        numberMoneryLab.layer.borderWidth = .5;
        numberMoneryLab.layer.borderColor = [UIColor brownColor].CGColor;
        numberMoneryLab.textAlignment = NSTextAlignmentCenter;
        [self addSubview:numberMoneryLab];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
